//
//  MYGHealthManagementTitleValueView.swift
//  MYGrow
//
//  Created by 林矗 on 2024/3/9.
//

import UIKit

class MYGHealthManagementTitleValueView: UIView {
    // MARK: - Property
    var title: String = "" {
        didSet {
            label.text = title
        }
    }
    
    var content: String = "" {
        didSet {
            contentLabel.text = content
        }
    }
    
    var alignment: NSTextAlignment = .center {
        didSet {
            label.textAlignment = alignment
            contentLabel.textAlignment = alignment
        }
    }
    
    // MARK: - init
    override init(frame: CGRect) {
        super.init(frame: frame)
        configUI()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    // MARK: - UI
    private func configUI() {
        addSubviews([
            label,
            contentLabel
        ])
        
        contentLabel.snp.makeConstraints { make in
            make.left.right.top.equalToSuperview()
            make.height.equalTo(22.5)
        }
        
        label.snp.makeConstraints { make in
            make.left.right.bottom.equalToSuperview()
            make.height.equalTo(16.5)
        }
    }
    
    // MARK: - Public funcs
    
    // MARK: - lazy load
    private lazy var label: UILabel = {
        let label = UILabel()
        label.textColor = .rgba(139, 139, 139)
        label.font = .regular(12)
        label.textAlignment = .center
        return label
    }()
    
    private lazy var contentLabel: UILabel = {
        let label = UILabel()
        label.textColor = .black
        label.font = .medium(16)
        label.textAlignment = .center
        return label
    }()
}
